//
//  DYJDInfoCell.swift
//  SheYangBigData
//
//  Created by 叁拾叁 on 2021/2/6.
//  Copyright © 2021 叁拾叁. All rights reserved.
//


import UIKit
import YYText
import SwiftDate

class DYJDInfoCell: SYBaseCell {
    
    var countNum: Int = 1 {
        didSet {
            self.count.text = "\(self.countNum)"
            (self.currentVC as! DYZSYuyueViewController).roomNum = self.countNum
        }
    }

    var bgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = .white
        v.layer.cornerRadius = 5
        v.layer.masksToBounds = true
        return v
    }()
    
    let name: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 18.autoBoldFontSize()
        
        return v
    }()
    
    let fangxing: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x666666)
        v.font = 13.autoFontSize()
        
        return v
    }()
    
    let shijian: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 16.autoFontSize()
        
        return v
    }()
    
    let guize: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x00C793)
        v.font = 13.autoFontSize()
        
        return v
    }()
    
    let count: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x666666)
        v.font = 18.autoFontSize()
        v.textAlignment = .center
        return v
    }()
   
    
    
    var jian: UIButton = {
        let v = UIButton()
        v.setImage(UIImage(named: "jiudian_jian"), for: .normal)
        return v
    }()
   

    let imgView: UIImageView = {
        let v = UIImageView()
        
        v.layer.cornerRadius = 3.autoWidth()
        return v
    }()
    
    var jia: UIButton = {
        let v = UIButton()
        v.setImage(UIImage(named: "jiudian_jia"), for: .normal)
        return v
    }()
    
    
    func configure(_ model: DYZSDetailModel, _ index: Int, _ choiceTime: String) {
        name.text  = model.roomList?[index].name
        fangxing.text = model.roomList?[index].label
        
        shijian.text = "1月18日-1月19日  共1晚"
        guize.text = "【\(choiceTime)】24:00前可免费取消"//2021-01-18
    }

    override func initViews() {
        
        count.text = "\(self.countNum)"
        
        jian.addAction {[weak self] in
            if let `self` = self {
                if self.countNum > 1 {
                    self.countNum -= 1
                } else {
                    self.currentVC.sy_toast("已经是最小了")
                }
            }
        }
        jia.addAction {[weak self] in
            if let `self` = self {
                self.countNum += 1
            }
        }
        self.backgroundColor = .clear
            contentView.addSubview(bgView)
        bgView.addSubview(name)
        bgView.addSubview(fangxing)
        bgView.addSubview(shijian)
        bgView.addSubview(guize)
        bgView.addSubview(count)
        bgView.addSubview(jian)
        bgView.addSubview(jia)
        bgView.addSubview(imgView)
        
        
        bgView.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalToSuperview()
            make.right.equalToSuperview()
            make.bottom.equalToSuperview().offset(-10.autoWidth())
        }
        
        name.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(14.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(20.autoWidth())
        }
        fangxing.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(44.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(14.autoWidth())
        }
        shijian.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(100.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(16.autoWidth())
        }
        guize.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(123.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(13.autoWidth())
            make.bottom.equalToSuperview().offset(-15.autoWidth())
        }
        count.snp.makeConstraints { (make) in
            make.top.bottom.equalTo(jian)
            make.left.equalTo(jian.snp.right)
            make.right.equalTo(jia.snp.left)
        }
        jian.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(103.autoWidth())
            make.right.equalToSuperview().offset(-82.autoWidth())
            make.height.equalTo(33.autoWidth())
            make.width.equalTo(33.autoWidth())
        }
        jia.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(103.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(33.autoWidth())
            make.width.equalTo(33.autoWidth())
        }
        imgView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(15.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(60.autoWidth())
            make.width.equalTo(90.autoWidth())
        }
    }
}




// MARK: -DYJDBiduCell
class DYJDBiduCell: SYBaseCell, UITableViewDelegate, UITableViewDataSource {
    
    var tableView: UITableView!

    var bgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = .white
        v.layer.cornerRadius = 5
        v.layer.masksToBounds = true
        return v
    }()
    
    let title: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0xFFA800)
        v.font = 15.autoFontSize()
        v.text  = "预定必读"
        return v
    }()
    
    let gengduo: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x979797)
        v.font = 13.autoFontSize()
        
        v.text = "更多 >"
        return v
    }()
   

    let imgView: UIImageView = {
        let v = UIImageView()
        v.sy_name("tanhao")
        return v
    }()
    

    
    func configure(_ model: DYZSDetailModel) {
        
    }

    override func initViews() {
        
        setTableView()
        self.backgroundColor = .clear
        addSubview(bgView)
        bgView.addSubview(title)
        bgView.addSubview(imgView)
        bgView.addSubview(gengduo)
        bgView.addSubview(tableView)
        
        bgView.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalToSuperview()
            make.right.equalToSuperview()
            make.bottom.equalToSuperview().offset(-10.autoWidth())
        }
        
        title.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(16.autoWidth())
            make.left.equalToSuperview().offset(34.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        gengduo.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(16.autoWidth())
            make.right.equalToSuperview().offset(-16.autoWidth())
            make.height.equalTo(12.autoWidth())
        }
        imgView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(15.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(18.autoWidth())
        }
        tableView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(42.autoWidth())
            make.left.right.equalToSuperview()
            make.height.equalTo(23.autoWidth()*3)
            make.bottom.equalToSuperview().offset(-12.autoWidth())
        }
    }
    
    func setTableView() {
        
        //创建表格视图
        self.tableView = UITableView(frame: CGRect(x: 0, y: NAV_HEIGHT, width: SCREEN_WIDTH, height: SCREEN_HEIGHT-NAV_HEIGHT-BOTTOM_SAFE_HEIGHT), style:.plain)
        self.tableView.separatorStyle = .none
        self.tableView.delegate = self
        self.tableView.dataSource = self
        self.tableView.isScrollEnabled = false
        self.tableView!.register(DYJDBiduSubCell.self, forCellReuseIdentifier: "Cell")
        self.contentView.addSubview(self.tableView!)
    }
    
    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 3
    }
    
    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell: DYJDBiduSubCell? = tableView.dequeueReusableCell(withIdentifier: "Cell") as? DYJDBiduSubCell
        cell?.selectionStyle = .none
        cell?.content.text = "订单需要等酒店或供应商确认后才生效，订单确认..."
        return cell!
    }
}




// MARK: -DYJDBiduSubCell
class DYJDBiduSubCell: SYBaseCell {
    
    let content: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 16.autoFontSize()
        v.text = "酒店仅接待大陆和港澳台客人"
        return v
    }()
    

    
    var fir: UIView = {
        let v = UIView()
        v.layer.cornerRadius = 2.5.autoWidth()
        v.backgroundColor = UIColor(hex: 0x888888)
        return v
    }()

    
    override func initViews() {
        
        addSubview(fir)
        addSubview(content)
        fir.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(12.autoWidth())
            make.top.equalToSuperview().offset(9.autoWidth())
            make.bottom.equalToSuperview().offset(-9.autoWidth())
            make.width.height.equalTo(5.autoWidth())
        }
        content.snp.makeConstraints { (make) in
            make.centerY.equalToSuperview()
            make.left.equalToSuperview().offset(31.autoWidth())
            make.right.equalToSuperview().offset(-19.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
    }
}




// MARK: -DYJDYudingInfoInputCell
class DYJDYudingInfoInputCell: SYBaseCell {
    

    var bgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = .white
        v.layer.cornerRadius = 5
        v.layer.masksToBounds = true
        return v
    }()
    
    let shuliangT: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0xA6A6A6)
        v.font = 15.autoFontSize()
        v.text  = "房间数量"
        return v
    }()
    
    let renT: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0xA6A6A6)
        v.font = 15.autoFontSize()
        v.text  = "入住人"
        return v
    }()
    
    let phoneT: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0xA6A6A6)
        v.font = 15.autoFontSize()
        v.text  = "联系手机"
        return v
    }()
    
    let yujiT: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0xA6A6A6)
        v.font = 15.autoFontSize()
        v.text  = "预计到店"
        return v
    }()

    let shuliang: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x1A1A1A)
        v.font = 15.autoFontSize()
        
        return v
    }()
    
    let xingming: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x888888)
        v.font = 12.autoFontSize()
        v.text  = "住客姓名"
        return v
    }()
    
    let zheng: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x888888)
        v.font = 12.autoFontSize()
        v.text  = "身份证号"
        return v
    }()
    
    let xingmingTf: UITextField = {
        let v:UITextField = UITextField()
        v.textColor = UIColor(hex: 0x1A1A1A)
        v.font = 15.autoFontSize()
        v.placeholder = "请填写姓名"
        return v
    }()
    
    let zhengTf: UITextField = {
        let v:UITextField = UITextField()
        v.textColor = UIColor(hex: 0x1A1A1A)
        v.font = 15.autoFontSize()
        v.placeholder = "请填写真实身份证号"
        return v
    }()
    
    let phoneTitle: VGBaseTitleImgView = {
        let v = VGBaseTitleImgView(frame: CGRect(x: 0, y: 0, width: 40.autoWidth(), height: 12.autoWidth()), type: .imgRight, showType: .byContent, imgSuperViewMargin: 4, imgTitleMargin: 4)
        v.imageV.sy_name("meishi_xiala")
        v.textLb.text = "+86"
        v.textLb.font = 15.autoFontSize()
        v.textLb.textColor = UIColor(hex: 0x333333)
        return v
    }()
    
    let phone: UITextField = {
        let v:UITextField = UITextField()
        v.textColor = UIColor(hex: 0x1A1A1A)
        v.font = 15.autoFontSize()
        v.placeholder = "请填写手机号"
        return v
    }()
    
    let shijian: UITextField = {
        let v:UITextField = UITextField()
        v.textColor = UIColor(hex: 0x1A1A1A)
        v.font = 15.autoFontSize()
        v.placeholder = "请填写"
        return v
    }()
    
    let baoliu: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 15.autoFontSize()
        v.text  = "房间将整晚保留"
        return v
    }()
    
    let imgView: UIImageView = {
        let v = UIImageView()
        v.image = UIImage(named: "zan_arrow")
        return v
    }()
    
    public var secLineView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = UIColor(hex: 0xE6E6E6)
        return v
    }()
    
    public var thirLineView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = UIColor(hex: 0xE6E6E6)
        return v
    }()
    
    public var fourLineView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = UIColor(hex: 0xE6E6E6)
        return v
    }()
    
    var shuxian: UIView = {
        let v = UIView()
        v.backgroundColor = UIColor(hex: 0xE5E5E5)
        return v
    }()
    
    
    func configure(_ model: DYZSDetailModel) {
        shuliang.text  = "\((self.currentVC as! DYZSYuyueViewController).roomNum)间（每间最多住两人）"
    }

    override func initViews() {
        
        
        
        self.backgroundColor = .clear
            contentView.addSubview(bgView)
        bgView.addSubview(shuliangT)
        bgView.addSubview(renT)
        bgView.addSubview(phoneT)
        bgView.addSubview(yujiT)
        bgView.addSubview(shuliang)
        bgView.addSubview(xingming)
        bgView.addSubview(zheng)
        bgView.addSubview(xingmingTf)
        
        bgView.addSubview(zhengTf)
        bgView.addSubview(phoneTitle)
        bgView.addSubview(phone)
        bgView.addSubview(shijian)
        bgView.addSubview(baoliu)
//        bgView.addSubview(imgView)
        bgView.addSubview(secLineView)
        bgView.addSubview(thirLineView)
        bgView.addSubview(fourLineView)
        bgView.addSubview(shuxian)
        bgView.addSubview(lineView)
        
        bgView.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalToSuperview()
            make.right.equalToSuperview()
            make.bottom.equalToSuperview().offset(-10.autoWidth())
        }
        
        shuliangT.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(21.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        renT.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(75.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        phoneT.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(172.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        yujiT.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(216.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(15.autoWidth())
            make.bottom.equalToSuperview().offset(-14.autoWidth())
        }
        shuliang.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(21.autoWidth())
            make.left.equalToSuperview().offset(83.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        xingming.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(58.autoWidth())
            make.left.equalToSuperview().offset(83.autoWidth())
            make.height.equalTo(12.autoWidth())
        }
        zheng.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(113.autoWidth())
            make.left.equalToSuperview().offset(83.autoWidth())
            make.height.equalTo(12.autoWidth())
        }
        xingmingTf.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(75.autoWidth())
            make.left.equalToSuperview().offset(83.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        
        
        zhengTf.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(132.autoWidth())
            make.left.equalToSuperview().offset(83.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        phoneTitle.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(172.autoWidth())
            make.left.equalToSuperview().offset(83.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        shuxian.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(172.autoWidth())
            make.left.equalToSuperview().offset(127.autoWidth())
            make.height.equalTo(15.autoWidth())
            make.width.equalTo(1.autoWidth())
        }
        phone.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(172.autoWidth())
            make.left.equalToSuperview().offset(133.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        shijian.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(216.autoWidth())
            make.left.equalToSuperview().offset(83.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        baoliu.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(216.autoWidth())
            make.left.equalToSuperview().offset(132.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
       
//        imgView.snp.makeConstraints { (make) in
//            make.top.equalToSuperview().offset(218.autoWidth())
//            make.right.equalToSuperview().offset(-10.autoWidth())
//            make.height.equalTo(12.autoWidth())
//            make.width.equalTo(7.autoWidth())
//        }
        secLineView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(103.autoWidth())
            make.left.equalToSuperview().offset(76.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(0.5.autoWidth())
        }
        thirLineView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(158.autoWidth())
            make.left.equalToSuperview().offset(76.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(0.5.autoWidth())
        }
        fourLineView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(200.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(0.5.autoWidth())
        }
        lineView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(49.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(0.5.autoWidth())
        }
    }
}


class DYJDFapiaoCell: SYBaseCell {
    
    var bgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = .white
        v.layer.cornerRadius = 5
        v.layer.masksToBounds = true
        return v
    }()
    
    let fapiaoT: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0xA6A6A6)
        v.font = 15.autoFontSize()
        v.text  = "发票"
        return v
    }()
    
    let fapiao: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x1A1A1A)
        v.font = 15.autoFontSize()
        v.text  = "如需发票，请向酒店前台索取"
        return v
    }()
    
    override func initViews() {
        self.backgroundColor = .clear
        addSubview(bgView)
        bgView.addSubview(fapiaoT)
        bgView.addSubview(fapiao)
        
        bgView.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalToSuperview()
            make.right.equalToSuperview()
            make.bottom.equalToSuperview().offset(-10.autoWidth())
        }
        fapiaoT.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalToSuperview().offset(10.autoWidth())
            make.bottom.equalToSuperview()
            make.height.equalTo(44.autoWidth())
        }
        fapiao.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalToSuperview().offset(83.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(44.autoWidth())
        }
    }
}


//class DYJDFeiyongCell: SYBaseCell {
//    
//    
//    var bgView: UIView = {
//        let v: UIView = UIView()
//        v.backgroundColor = .white
//        v.layer.cornerRadius = 5
//        v.layer.masksToBounds = true
//        return v
//    }()
//    
//    let title: UILabel = {
//        let v:UILabel = UILabel()
//        v.textColor = UIColor(hex: 0x1A1A1A)
//        v.font = 16.autoBoldFontSize()
//        v.text  = "费用明细"
//        return v
//    }()
//    
//    let zhifu: UILabel = {
//        let v:UILabel = UILabel()
//        v.textColor = UIColor(hex: 0x333333)
//        v.font = 15.autoFontSize()
//        v.text  = "在线支付"
//        return v
//    }()
//    
//    let fangfei: UILabel = {
//        let v:UILabel = UILabel()
//        v.textColor = UIColor(hex: 0x333333)
//        v.font = 15.autoFontSize()
//        v.text  = "在线支付"
//        return v
//    }()
//    
//    let tip: UILabel = {
//        let v:UILabel = UILabel()
//        v.textColor = UIColor(hex: 0x999999)
//        v.font = 13.autoFontSize()
//        v.text  = "2021-01-19   有早餐"
//        return v
//    }()
//    
//    let gong: UILabel = {
//        let v:UILabel = UILabel()
//        v.textColor = UIColor(hex: 0xAFAFAF)
//        v.font = 12.autoFontSize()
//        v.text  = "1间1晚  共"
//        return v
//    }()
//    
//    let zhifuPrice: YYLabel = {
//        let v = YYLabel()
//        v.font = 12.autoFontSize()
//        v.text = "¥358"
//        v.textColor = UIColor(hex: 0xF55035)
//        return v
//    }()
//    
//    let fangfeiPrict: UILabel = {
//        let v:UILabel = UILabel()
//        v.textColor = UIColor(hex: 0x2C2C2C)
//        v.font = 12.autoFontSize()
//        v.text  = "¥358"
//        return v
//    }()
//    
//    let zaocanPrice: UILabel = {
//        let v:UILabel = UILabel()
//        v.textColor = UIColor(hex: 0x999999)
//        v.font = 12.autoFontSize()
//        v.text  = "1*￥358"
//        return v
//    }()
//    
//    public var secLineView: UIView = {
//        let v: UIView = UIView()
//        v.backgroundColor = UIColor(hex: 0xE6E6E6)
//        return v
//    }()
//    
//    override func initViews() {
//        
//        self.backgroundColor = .clear
//        addSubview(bgView)
//        bgView.addSubview(title)
//        bgView.addSubview(zhifu)
//        bgView.addSubview(fangfei)
//        bgView.addSubview(tip)
//        
//        bgView.addSubview(gong)
//        bgView.addSubview(zhifuPrice)
//        bgView.addSubview(fangfeiPrict)
//        bgView.addSubview(secLineView)
//        bgView.addSubview(zaocanPrice)
//        bgView.addSubview(lineView)
//        
//        bgView.snp.makeConstraints { (make) in
//            make.top.equalToSuperview()
//            make.left.equalToSuperview()
//            make.right.equalToSuperview()
//            make.bottom.equalToSuperview().offset(-10.autoWidth())
//        }
//        title.snp.makeConstraints { (make) in
//            make.top.equalToSuperview().offset(18.autoWidth())
//            make.left.equalToSuperview().offset(10.autoWidth())
//            make.height.equalTo(16.autoWidth())
//        }
//        zhifu.snp.makeConstraints { (make) in
//            make.top.equalToSuperview().offset(66.autoWidth())
//            make.left.equalToSuperview().offset(10.autoWidth())
//            make.height.equalTo(15.autoWidth())
//        }
//        fangfei.snp.makeConstraints { (make) in
//            make.top.equalToSuperview().offset(113.autoWidth())
//            make.left.equalToSuperview().offset(10.autoWidth())
//            make.height.equalTo(15.autoWidth())
//        }
//        tip.snp.makeConstraints { (make) in
//            make.top.equalToSuperview().offset(141.autoWidth())
//            make.left.equalToSuperview().offset(10.autoWidth())
//            make.height.equalTo(15.autoWidth())
//            make.bottom.equalToSuperview().offset(-15.autoWidth())
//        }
//        
//        gong.snp.makeConstraints { (make) in
//            make.top.equalToSuperview().offset(68.autoWidth())
//            make.right.equalToSuperview().offset(-51.autoWidth())
//            make.height.equalTo(15.autoWidth())
//        }
//        zhifuPrice.snp.makeConstraints { (make) in
//            make.top.equalToSuperview().offset(67.autoWidth())
//            make.right.equalToSuperview().offset(-10.autoWidth())
//            make.height.equalTo(15.autoWidth())
//        }
//        fangfeiPrict.snp.makeConstraints { (make) in
//            make.top.equalToSuperview().offset(114.autoWidth())
//            make.right.equalToSuperview().offset(-10.autoWidth())
//            make.height.equalTo(15.autoWidth())
//        }
//        zaocanPrice.snp.makeConstraints { (make) in
//            make.top.equalToSuperview().offset(143.autoWidth())
//            make.right.equalToSuperview().offset(-10.autoWidth())
//            make.height.equalTo(15.autoWidth())
//        }
//        secLineView.snp.makeConstraints { (make) in
//            make.top.equalToSuperview().offset(97.autoWidth())
//            make.left.equalToSuperview().offset(10.autoWidth())
//            make.right.equalToSuperview().offset(-10.autoWidth())
//            make.height.equalTo(0.5.autoWidth())
//        }
//  
//        lineView.snp.makeConstraints { (make) in
//            make.top.equalToSuperview().offset(50.autoWidth())
//            make.left.equalToSuperview().offset(10.autoWidth())
//            make.right.equalToSuperview().offset(-10.autoWidth())
//            make.height.equalTo(0.5.autoWidth())
//        }
//    }
//}


class DYJDFeiyongCell: SYBaseCell {
    
    
    var bgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = .white
        v.layer.cornerRadius = 5
        v.layer.masksToBounds = true
        return v
    }()
    
    let title: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x1A1A1A)
        v.font = 16.autoBoldFontSize()
        v.text  = "费用明细"
        return v
    }()
    
    let zhifu: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 15.autoFontSize()
        v.text  = "在线支付"
        return v
    }()
    
    let fangfei: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 15.autoFontSize()
        v.text  = "房费"
        return v
    }()
    
    let tip: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x999999)
        v.font = 13.autoFontSize()
        
        return v
    }()
    
    let gong: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0xAFAFAF)
        v.font = 12.autoFontSize()
        
        return v
    }()
    
    let zhifuPrice: YYLabel = {
        let v = YYLabel()
        v.font = 12.autoFontSize()
        
        v.textColor = UIColor(hex: 0xF55035)
        return v
    }()
    
    let fangfeiPrict: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x2C2C2C)
        v.font = 12.autoFontSize()
        
        return v
    }()
    
    let zaocanPrice: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x999999)
        v.font = 12.autoFontSize()
        
        return v
    }()
    
    public var secLineView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = UIColor(hex: 0xE6E6E6)
        return v
    }()
    
    func configure(_ model: DYZSDetailModel, _ selectIndex: Int, _ selectTime: String, _ dayNum: Int) {
        
        if model.roomList?[selectIndex].breakfast != 0 {
            tip.text  = "\(selectTime)   有早餐"
        } else {
            tip.text  = "\(selectTime)   无早餐"
        }
        
        gong.text  = "\((self.currentVC as! DYZSYuyueViewController).roomNum)间\(dayNum)晚  共"
        let count = (self.currentVC as! DYZSYuyueViewController).roomNum * dayNum
        let rate = model.roomList?[selectIndex].rates ?? "0"
        let zongjia = Double(count) * (Double(rate) ?? 0.0)
        let zongjiaStr = String(format: "%.2f", zongjia)
        zhifuPrice.text = "¥\(zongjiaStr)"
        fangfeiPrict.text  = "¥\(zongjiaStr)"
        zaocanPrice.text  = "\(count)*￥\(rate)"
    }
    
    override func initViews() {
        
        self.backgroundColor = .clear
        addSubview(bgView)
        bgView.addSubview(title)
        bgView.addSubview(zhifu)
        bgView.addSubview(fangfei)
        bgView.addSubview(tip)
        
        bgView.addSubview(gong)
        bgView.addSubview(zhifuPrice)
        bgView.addSubview(fangfeiPrict)
        bgView.addSubview(secLineView)
        bgView.addSubview(zaocanPrice)
        bgView.addSubview(lineView)
        
        bgView.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalToSuperview()
            make.right.equalToSuperview()
            make.bottom.equalToSuperview().offset(-10.autoWidth())
        }
        title.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(18.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(16.autoWidth())
        }
        zhifu.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(66.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        fangfei.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(113.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        tip.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(141.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(15.autoWidth())
            make.bottom.equalToSuperview().offset(-15.autoWidth())
        }
        
        gong.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(68.autoWidth())
            make.right.equalTo(zhifuPrice.snp.left).offset(-5.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        zhifuPrice.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(67.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        fangfeiPrict.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(114.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        zaocanPrice.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(143.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        secLineView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(97.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(0.5.autoWidth())
        }
  
        lineView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(50.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(0.5.autoWidth())
        }
    }
}
class DYJDTipCell: SYBaseCell {
    
    
    var bgView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = .white
        v.layer.cornerRadius = 5
        v.layer.masksToBounds = true
        return v
    }()
    
    let title: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x1A1A1A)
        v.font = 16.autoBoldFontSize()
        v.text  = "重要提示"
        return v
    }()
    
    let zhifuT: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 15.autoFontSize()
        v.text  = "在线支付"
        return v
    }()
    
    let guizeT: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 15.autoFontSize()
        v.text  = "退款规则"
        return v
    }()
    
    let shuomingT: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x333333)
        v.font = 15.autoFontSize()
        v.text  = "预订说明"
        return v
    }()
    
    
    
    let guize: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x999999)
        v.font = 13.autoFontSize()
        v.text  = "仅限本人预订，根据酒店政策，预订成功后不可取消/变更，如未入住，酒店将扣除全额房费"
        v.numberOfLines = 0
        return v
    }()
    
    let shuoming: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0x999999)
        v.font = 13.autoFontSize()
        v.text  = "提示：您的个人信息会同步入住酒店仅在办理入住使用；订单需等酒店或供应商确认后才生效，订单确认结果以平台发送的短信通知为准；请在订单生效后再至酒店前台办理入住。"
        v.numberOfLines = 0
        return v
    }()
    
    let gong: UILabel = {
        let v:UILabel = UILabel()
        v.textColor = UIColor(hex: 0xAFAFAF)
        v.font = 12.autoFontSize()
        v.text  = "1间1晚  共"
        return v
    }()
    
    let zhifuPrice: YYLabel = {
        let v = YYLabel()
        v.font = 12.autoFontSize()
        v.text = "¥358"
        v.textColor = UIColor(hex: 0xF55035)
        return v
    }()
    
    public var secLineView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = UIColor(hex: 0xE6E6E6)
        return v
    }()
    
    public var thirLineView: UIView = {
        let v: UIView = UIView()
        v.backgroundColor = UIColor(hex: 0xE6E6E6)
        return v
    }()
    
    func configure(_ model: DYZSDetailModel, _ selectIndex: Int, _ dayNum: Int) {
        
        gong.text  = "\((self.currentVC as! DYZSYuyueViewController).roomNum)间\(dayNum)晚  共"
        let count = (self.currentVC as! DYZSYuyueViewController).roomNum * dayNum
        let rate = model.roomList?[selectIndex].rates ?? "0"
        let zongjia = Double(count) * (Double(rate) ?? 0.0)
        let zongjiaStr = String(format: "%.2f", zongjia)
        zhifuPrice.text = "¥\(zongjiaStr)"
    }
    
    override func initViews() {
        
        self.backgroundColor = .clear
        addSubview(bgView)
        bgView.addSubview(title)
        bgView.addSubview(zhifuT)
        bgView.addSubview(guizeT)
        bgView.addSubview(shuomingT)
        
        bgView.addSubview(guize)
        bgView.addSubview(shuoming)
        bgView.addSubview(gong)
        bgView.addSubview(zhifuPrice)
        bgView.addSubview(thirLineView)
        bgView.addSubview(secLineView)
        bgView.addSubview(lineView)
        
        bgView.snp.makeConstraints { (make) in
            make.top.equalToSuperview()
            make.left.equalToSuperview()
            make.right.equalToSuperview()
            make.bottom.equalToSuperview().offset(-10.autoWidth())
        }
        title.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(18.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(16.autoWidth())
        }
        zhifuT.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(66.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        guizeT.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(113.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        shuomingT.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(209.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        
        gong.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(68.autoWidth())
            make.right.equalTo(zhifuPrice.snp.left).offset(-5.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        zhifuPrice.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(67.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(15.autoWidth())
        }
        guize.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(141.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            
        }
        shuoming.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(234.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.bottom.equalToSuperview().offset(-22.autoWidth())
        }
        secLineView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(97.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(0.5.autoWidth())
        }
        
        thirLineView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(192.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(0.5.autoWidth())
        }
  
        lineView.snp.makeConstraints { (make) in
            make.top.equalToSuperview().offset(50.autoWidth())
            make.left.equalToSuperview().offset(10.autoWidth())
            make.right.equalToSuperview().offset(-10.autoWidth())
            make.height.equalTo(0.5.autoWidth())
        }
    }
}
